<template>
<!-- 视频标签切换页 -->
  <div class="Tab">
    <div class="title">{{ item }}></div>
    <div class="category">
      <span v-for="(item, index) in category" :key="index" :class="{ active: currentIndex === index }" @click="tabClick(index, item.id)">{{ item.name }}</span>
    </div>
  </div>
</template>

<script>
export default {
  props: ['category', 'currentItem'],
  data() {
    return {
      currentIndex: 0,
      item: this.currentItem,
    };
  },
  computed: {},
  created() {},
  components: {},
  methods: {
    // tabbar切换点击
    tabClick(index, id) {
      this.currentIndex = index;
      this.item = this.category[this.currentIndex].name;
      this.$emit('tabClick', id);
    },
  },
};
</script>

<style scoped lang='scss'>
.Tab {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin: 20px 0;
  .title {
    width: 100px;
    text-align: center;
    border: solid 1px $grayHover;
    border-radius: 15px;
    padding: 5px;
    font-size: 14px;
  }
  .category {
    font-size: 13px;
    span {
      color: #919191;
      cursor: pointer;
      padding: 2px 10px;
      &:hover {
        color: #000;
      }
    }
    .active {
      background-color: #f0ddddbd;
      color: red;
      border-radius: 10px;
    }
  }
}
</style>